package ctrl

import (
	"fmt"

	"github.com/extrame/goblet"
)

type RestCtrl struct {
	goblet.Route `/rest/first`
}

type TestResult struct {
	Mobile string
}

func (r *RestCtrl) Read(id string, ctx *goblet.Context) (*TestResult, error) {
	return &TestResult{
		Mobile: "18612345678",
	}, nil
}

func (r *RestCtrl) Update(id string, ctx *goblet.Context, args *TestResult) error {
	fmt.Println("收到的参数是：", args)
	if args.Mobile == "" {
		return fmt.Errorf("手机号不能为空")
	}
	return nil
}
